package com.xl.web.service.sys;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xl.base.annotation.DataSource;
import com.xl.base.service.BaseService;
import com.xl.web.dao.sys.SysMenuBtnDao;
import com.xl.web.dao.sys.SysRoleDao;
import com.xl.web.entity.sys.SysMenuBtn;
import com.xl.web.entity.sys.SysRole;

/**
 * 菜单按钮操作Service
 * 
 * @author 梁华
 * 
 * @param <T>
 */
@Service("sysMenuBtnService")
public class SysMenuBtnService<T extends SysMenuBtn> extends
		BaseService<SysMenuBtn> {

	// 菜单按钮基础Dao
	@Autowired(required = false)
	private SysMenuBtnDao<SysMenuBtn> sysMenuBtnDao;

	// 角色基础Dao
	@Autowired(required = false)
	private SysRoleDao<SysRole> sysRoleDao;

	public SysMenuBtnDao<SysMenuBtn> getDao() {
		return sysMenuBtnDao;
	}

	/**
	 * 删除数据
	 */
	@Override
	public void delete(Object... ids) throws Exception {
		if (ids == null || ids.length < 1) {
			return;
		}
		for (Object id : ids) {
			this.sysRoleDao.deleteRoleMenuByMenuId(id);
			getDao().delete(id);
		}
	}
}
